package com.carrot.newsgallery.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.beans.factory.annotation.Value;

import java.time.LocalDate;

@Data
@Api(value = "用户个人信息")
public class UserInfo {
    @ApiModelProperty(value = "自增主键")
    @TableId(value = "id", type = IdType.AUTO)
    private int userInfoId;
    @ApiModelProperty(value = "用户名")
    private String username;
    @ApiModelProperty(value = "当日排名")
    private String password;
    @ApiModelProperty(value = "用户昵称")
    private String alias;
    @ApiModelProperty(value = "用户手机")
    private String phone;
    @ApiModelProperty(value = "用户邮箱")
    private String email;
    @ApiModelProperty(value = "用户头像请求方法")
    private String avatar;
    @ApiModelProperty(value = "用户唯一身份标识uuid")
    private String uuid;
    @ApiModelProperty(value = "用户账户状态")
    private int status;
    @ApiModelProperty(value = "账户创建时间")
    private LocalDate createDate;

    public static UserInfo extractPublicInfo(UserInfo userInfo,String rootpath){

        userInfo.setPassword(null);
        userInfo.setAvatar(rootpath+"/user/public/" + userInfo.getUuid());
        return userInfo;
    }
}
